import 'package:car_map/mode/driving_model.dart';
import 'package:car_map/widget/widget_driving_item.dart';
import 'package:flutter/material.dart';
///代驾服务
class DrivingPage extends StatefulWidget{
  @override
  _drivingState createState()=>_drivingState();
}

class _drivingState extends State<DrivingPage>{

  List<DrivingModel> modelList;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    drivingList();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('代驾服务'),
      ),
      body: Container(
          child:ListView.builder(itemBuilder: (context,index){
            return  WidgetDrivingItem(model: modelList[index],);
          },itemCount: modelList.length,),
      ),
    );
  }


  List<DrivingModel> drivingList(){
     modelList=new List();
     modelList.add(new DrivingModel(
       urlPath: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573021329764&di=53aab1143bd5c638255a27a89fd0b990&imgtype=0&src=http%3A%2F%2Fcdn.duitang.com%2Fuploads%2Fitem%2F201507%2F27%2F20150727151430_E5CS4.thumb.700_0.jpeg',
       name: '张瑶',
       sex: '女',
       age: 22,
       drivingAge: 4,
       starNum: 4,
       phone: '18700453955',
       company: '陕西明锐科技公司'
     ));

     modelList.add(new DrivingModel(
         urlPath: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1138496308,1711557961&fm=26&gp=0.jpg',
         name: '德华',
         sex: '男',
         age: 20,
         drivingAge: 3,
         starNum: 2,
         phone: '18700453945',
         company: '陕西中软国际外包系'
     ));

     modelList.add(new DrivingModel(
         urlPath: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573024435567&di=b8fb26fc2466eae94e408b42dd55ce43&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn%2Fw640h853%2F20180102%2F6844-fyqefvx0721115.jpg',
         name: '空空',
         sex: '女',
         age: 25,
         drivingAge: 8,
         starNum: 5,
         phone: '18700453946',
         company: '陕西西安摄影公司'
     ));
  }
}